#!/bin/bash

export LC_ALL=C

BASE_AN_DIR=$1

for AN_DIR in `find $BASE_AN_DIR -maxdepth 1 -mindepth 1 -type d | sort`; do
    if [ ! -f $AN_DIR/results_go_exact.txt ] ; then
        echo $(basename $AN_DIR) >&2
        continue
    fi
    echo -ne $(basename $AN_DIR)"\t"
    cat $AN_DIR/results_go_exact.txt \
        | cut -f3 | awk '{print $1}' | awk '{if ($1>10) {print 0} else {print $1}}' | sort | uniq -c \
        | 9_annotation_analysis/analize_annotation.py --tsv
done

